<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="/assets/css/admin.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/amazeui.css" rel="stylesheet" type="text/css">

    <link href="/css/personal.css" rel="stylesheet" type="text/css">
    <link href="/css/infstyle.css" rel="stylesheet" type="text/css">
    <script src="/assets/js/jquery.min.js" type="text/javascript"></script>
    <script src="/assets/js/amazeui.js" type="text/javascript"></script>


    <th:block th:include="common.html :: source"></th:block>

    <script>
        function upload() {
            $("#upload").submit();
        }
    </script>
</head>
<body>

<th:block th:include="common.html :: header"></th:block>

<div class="i_bg bg_color">
    <div class="m_content">

        <div class="m_left">
            <div class="left_n">管理中心</div>
            <div class="left_m">
                <div class="left_m_t t_bg1">订单中心</div>
                <ul>
                    <li><a href="/order/getOrderList" >我的订单</a></li>
                </ul>
            </div>
            <div class="left_m">
                <div class="left_m_t t_bg2">会员中心</div>
                <ul>
                    <li><a href="/user/info" >用户信息</a></li>
                    <li><a href="/userAddress/getAddressList" >地址管理</a></li>
                </ul>
            </div>
        </div>

        <div class="m_right" id="content" style="min-height: 600px;height: 600px">
            <div class="m_des" style="height: 160px">
                <table border="0" style="width:870px; line-height:22px;" cellspacing="0" cellpadding="0">
                    <tr valign="top">
                        <td width="115">
<!--                            <img src="/images/3.jpg" width="90" height="90" />-->
                            <form action="/user/upload" enctype="multipart/form-data" method="post" id="upload">
                                <div class="filePic">
                                    <input name="touxiang" type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*" onchange="upload()">
                                    <img class="am-circle am-img-thumbnail" th:src="'/profilePhoto/'+${nowUser.fileName}" alt="" />
                                </div>
                            </form>
                        </td>
                        <td style="position: relative;top: -105px;right: -45px">
                            <div class="m_user" th:text="${nowUser.userName}"></div><br />
                            <p>
                                性别:
                                <span th:if="${nowUser.gender==0}">女</span>
                                <span th:if="${nowUser.gender==1}">男</span>
                                <span th:if="${nowUser.gender==-1}">保密</span>
                                <br /><br />
                                邮箱:
                                <span th:text="${nowUser.email}"></span><br /><br />
                                电话:
                                <span th:text="${nowUser.mobile}"></span><br /><br />
                            </p>
                        </td>
                    </tr>
                </table>
            </div>


            <div class="info-main">
                <form class="am-form am-form-horizontal" style="position: relative; top: 35px">

                    <div class="am-form-group">
                        <label for="user-name2" class="am-form-label">昵称</label>
                        <div class="am-form-content">
                            <input type="text" id="user-name2" th:placeholder="${nowUser.userName}" th:value="${nowUser.userName}">
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-form-label">性别</label>
                        <div class="am-form-content sex">
                            <label class="am-radio-inline">
                                <input th:if="${nowUser.gender==1}" type="radio" name="radio10" value="1"  checked th:text="男">
                                <input th:if="${nowUser.gender!=1}" type="radio" name="radio10" value="1" data-am-ucheck th:text="男">
                            </label>
                            <label class="am-radio-inline">
                                <input th:if="${nowUser.gender==0}" type="radio" name="radio10" value="0" checked th:text="女">
                                <input th:if="${nowUser.gender!=0}" type="radio" name="radio10" value="0" data-am-ucheck th:text="女">
                            </label>
                            <label class="am-radio-inline">
                                <input th:if="${nowUser.gender==-1}" type="radio" name="radio10" value="-1" checked th:text="保密">
                                <input th:if="${nowUser.gender!=-1}" type="radio" name="radio10" value="-1" data-am-ucheck th:text="保密">
                            </label>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label for="user-phone" class="am-form-label">电话</label>
                        <div class="am-form-content">
                            <input id="user-phone" th:placeholder="${nowUser.mobile}" th:value="${nowUser.mobile}" type="tel">

                        </div>
                    </div>
                    <div class="am-form-group">
                        <label for="user-email" class="am-form-label">邮箱</label>
                        <div class="am-form-content">
                            <input id="user-email" th:placeholder="${nowUser.email}" th:value="${nowUser.email}" type="email">

                        </div>
                    </div>
                    <div class="info-btn">
                        <div class="am-btn am-btn-danger" th:onclick="updateUser([[${nowUser.id}]])">保存修改</div>
                    </div>
                </form>
<!--                <input id="nichen" type="hidden" th:value="${nowUser.userName}">-->
<!--                <input id="shi" type="hidden" th:value="${nowUser.gender}">-->
<!--                <input id="qu" type="hidden" th:value="${address.area}">-->
<!--                <input id="dizhi" type="hidden" th:value="${address.address}">-->
<!--                <input id="id" type="hidden" th:value="${address.id}">-->
<!--                <input id="type" type="hidden" th:value="${type}">-->
            </div>
        </div>
    </div>
</div>
<th:block th:include="common.html :: footer"></th:block>
<th:block th:include="common.html :: permit"></th:block>
</body>
<script>
    function updateUser(id) {
        var userName = $("#user-name2").val();
        var mobile = $("#user-phone").val();
        var sex = document.getElementsByName("radio10")
        var gender;
        for(var i=0;i<sex.length;i++){
            if(sex[i].checked){
                gender = sex[i].value;
            }
        }
        var email = $("#user-email").val();
        window.location.href="/user/update/"+id+"/"+userName+"/"+gender+"/"+mobile+"/"+email;
    }
</script>
</html>